/**
 * Copyright (C), 2021, 因特驰
 * FileName: BuyerServiceImpl
 * Author:   李晋武
 * Date:     2021/7/14 16:06
 * Description:
 * History:
 * 李晋武          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package com.esc.service.impl;

import com.esc.mapper.BuyerMapper;
import com.esc.model.Buyer;
import com.esc.service.BuyerService;
import com.esc.util.PageResult;
import com.esc.util.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author Yun
 * @create 2021/7/14
 * @since 1.0.0
 */
@Service
public class BuyerServiceImpl implements BuyerService {

    @Autowired
    private BuyerMapper buyerMapper;

    @Override
    public PageResult queryBuyerList(PageUtil<Buyer> pageUtil,Integer queryId) {
        PageResult page = new PageResult();
        int total = buyerMapper.queryCount(queryId);
        page.setTotal(total);
        List<Buyer> list = buyerMapper.queryBuyerList(pageUtil.getStartIndex(),pageUtil.getRows(),queryId);
        page.setRows(list);
        return page;
    }

    @Override
    public void updateBuyerStauts(Integer buyerid,Integer status) {
        buyerMapper.updateBuyerStauts(buyerid,status);
    }

    @Override
    public Buyer queryBuyerById(Integer buyerid) {
        return buyerMapper.queryBuyerById(buyerid);
    }

    @Override
    public void updateBuyer(Buyer buyer) {
        buyerMapper.updateBuyer(buyer);
    }
}